<% layout('/layouts/default.html', {title: '信息发布管理', libs: ['validate','fileupload','ueditor']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header with-border">
            <div class="box-title">
                <i class="fa fa-list-alt"></i>
                ${shInfo.type==1?"关于我们":shInfo.type==2?"资讯百科":shInfo.type==3?"新闻动态":"联系我们"}
            </div>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
            </div>
        </div>
        <#form:form id="inputForm" model="${shInfo}" action="${ctx}/sys/shInfo/save" method="post"
        class="form-horizontal">
        <div class="box-body">
            <div class="form-unit">${text('基本信息')}</div>
            <#form:hidden path="id"/>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required ">*</span> 标题：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="title" maxlength="100" class="form-control required"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> 来源：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="source" maxlength="20" class="form-control"
                            placeholder="默认来源:${@Global.getConfig('info.default.source')}"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required hide">*</span> TKD标题：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:textarea path="tkdTitle" rows="2" maxlength="150" class="form-control" placeholder="SEO功能"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required hide">*</span> TKD关键字：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:textarea path="tkdKeywords" rows="2" maxlength="150" class="form-control" placeholder="SEO功能"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required hide">*</span> TKD描述：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:textarea path="tkdDesc" rows="4" maxlength="255" class="form-control" placeholder="SEO功能"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required ">*</span> 类型：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input value='${@DictUtils.getDictLabel("sys_info_type",shInfo.type+"","未知")}'
                            class="form-control required" readonly="true"/>
                            <#form:hidden path="type"/>
                            <!--<#form:select path="type" dictType="sys_info_type" class="form-control required digits" disabled="true"/>-->
                        </div>
                    </div>
                </div>
                <% if ( shInfo.type == 2||shInfo.type == 3||shInfo.type == 5 ){ %>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> 所属栏目：<i class="fa icon-question hide "></i></label>
                        <div class="col-sm-8">
                            <#form:select path="menuCol" items="${dataList}" itemLabel="dictLabelOrig"
                            itemValue="dictValue" class="form-control" />
                        </div>
                    </div>
                </div>
                <% } %>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required hide">*</span> 简介：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:textarea path="describe" rows="8" maxlength="100" class="form-control"
                            placeholder="不填写默认提取内容前:${@Global.getConfig('info.default.length')}个字符"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required ">*</span> 内容：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:ueditor maxlength="10000" path="content" class="required"
                            simpleToolbars="true" outline="false"/>
                        </div>
                    </div>
                </div>
            </div>
            <#form:hidden path="thumbnail" />
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2"><span class="required ">*</span>缩略图片：</label>
                        <div class="col-sm-10">
                            <#form:fileupload id="uploadImage" bizKey="${shInfo.id}" bizType="shInfo_image"
                            uploadType="image" class="required" readonly="false"
                            returnPath="true" filePathInputId="thumbnail"
                            maxUploadNum="1" imageMaxWidth="475" imageMaxHeight="270" isMini="true"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> 是否热门：<i class="fa icon-question hide "></i></label>
                        <div class="col-sm-8">
                            <#form:select path="isHot" dictType="service_yes_no" class="form-control required" />
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> 访问数量：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="visitNum" maxlength="11" class="form-control number"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-10">
                    <% if (hasPermi('sys:shInfo:edit')){ %>
                    <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i>
                        ${text('保 存')}
                    </button>&nbsp;
                    <% } %>
                    <button type="button" class="btn btn-sm btn-default" id="btnCancel"
                            onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}
                    </button>
                </div>
            </div>
        </div>
    </#form:form>
</div>
</div>
<% } %>
<script>
    $("#inputForm").validate({
        submitHandler: function (form) {
            js.ajaxSubmitForm($(form), function (data) {
                js.showMessage(data.message);
                if (data.result == Global.TRUE) {
                    js.closeCurrentTabPage(function (contentWindow) {
                        contentWindow.page();
                    });
                }
            }, "json");
        }
    });
</script>